home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / tnos / tnos100s / proc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-24  |  2.5 KB  |  85 lines

  1. #ifndef    _PROC_H
  2. #define    _PROC_H
  3.  
  4. #if defined(TNOS_68K) && !defined(_OSK_H)
  5. #include "osk.h"
  6. #endif
  7.  
  8. #include <setjmp.h>
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef    _TIMER_H
  15. #include "timer.h"
  16. #endif
  17.  
  18. #define    OUTBUFSIZE    512    /* Size to be malloc'ed for outbuf */
  19.  
  20. /* Kernel process control block */
  21. #define    PHASH    16        /* Number of wait table hash chains */
  22. struct proc {
  23.     struct proc *prev;    /* Process table pointers */
  24.     struct proc *next;    
  25.  
  26.     jmp_buf env;        /* Process state */
  27.     char i_state;        /* Process interrupt state */
  28.  
  29.     unsigned short state;
  30. #define    READY    0
  31. #define    WAITING    1
  32. #define    SUSPEND    2
  33.     void *event;        /* Wait event */
  34.     int16 *stack;        /* Process stack */
  35.     unsigned stksize;    /* Size of same */
  36.     char *name;        /* Arbitrary user-assigned name */
  37.     int retval;        /* Return value from next pwait() */
  38.     struct timer alarm;    /* Alarm clock timer */
  39.     struct mbuf *outbuf;    /* Terminal output buffer */
  40.     int input;        /* standard input socket */
  41.     int output;        /* standard output socket */
  42.     int iarg;        /* Copy of iarg */
  43.     void *parg1;        /* Copy of parg1 */
  44.     void *parg2;        /* Copy of parg2 */
  45.     int freeargs;        /* Free args on termination if set */
  46. };
  47. #define NULLPROC (struct proc *)0
  48. extern struct proc *Waittab[];    /* Head of wait list */
  49. extern struct proc *Rdytab;    /* Head of ready list */
  50. extern struct proc *Curproc;    /* Currently running process */
  51. extern struct proc *Susptab;    /* Suspended processes */
  52. extern int Stkchk;        /* Stack checking flag */
  53.  
  54. /* In  kernel.c: */
  55. void alert __ARGS((struct proc *pp,int val));
  56. void chname __ARGS((struct proc *pp,char *newname));
  57. void killproc __ARGS((struct proc *pp));
  58. void killself __ARGS((void));
  59. struct proc *mainproc __ARGS((char *name));
  60. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  61.     void (*pc) __ARGS((int,void *,void *)),
  62.     int iarg,void *parg1,void *parg2,int freeargs));
  63. int psignal __ARGS((void *event,int n));
  64. int pwait __ARGS((void *event));
  65. void resume __ARGS((struct proc *pp));
  66. void suspend __ARGS((struct proc *pp));
  67.  
  68. /* In ksubr.c: */
  69. void chkstk __ARGS((void));
  70. void kinit __ARGS((void));
  71. unsigned phash __ARGS((void *event));
  72. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  73.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  74. #ifdef    AMIGA
  75. void init_psetup __ARGS((struct proc *pp));
  76. #endif
  77.  
  78. /* Stack background fill value for high water mark checking */
  79. #define    STACKPAT    0x55aa
  80.  
  81. /* Value stashed in location 0 to detect null pointer dereferences */
  82. #define    NULLPAT        0xdead
  83.  
  84. #endif    /* _PROC_H */
  85.